package com.sinux.generality.authorization.service;

import java.util.List;
import java.util.Set;

import javax.swing.tree.TreeModel;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sinux.generality.authorization.entity.SysPermission;
import com.sinux.generality.common.exception.GeneralityException;

/**
 * <p>
 * 菜单权限表 服务类
 * </p>
 *
 * @Author scott
 * @since 2018-12-21
 */
public interface ISysPermissionService extends IService<SysPermission> {
	
	public List<TreeModel> queryListByParentId(String parentId);
	
	/**真实删除*/
	public void deletePermission(String id) throws GeneralityException;
	/**逻辑删除*/
	public void deletePermissionLogical(String id) throws GeneralityException;
	
	public void addPermission(SysPermission sysPermission) throws GeneralityException;
	
	public void editPermission(SysPermission sysPermission) throws GeneralityException;
	
	public List<SysPermission> queryByUser(String username, String appName);
	
	/**
	 * 根据permissionId删除其关联的SysPermissionDataRule表中的数据
	 * 
	 * @param id
	 * @return
	 */
	public void deletePermRuleByPermId(String id);
	
	/**
	  * 查询出带有特殊符号的菜单地址的集合
	 * @return
	 */
	public List<String> queryPermissionUrlWithStar();
	
	/**
	 * 通过用户名获取用户权限集合
	 *
	 * @param username 用户名
	 * @param appName 模块名
	 * @return 权限集合
	 */
	Set<String> getUserPermissionsSet(String username, String appName);

    /**
     * 
     * @Title: checkUserPermission 
     * @Description: TODO
     * @param username
     * @param appName
     * @param target
     * @param resource
     * @param permission
     * @return boolean    返回类型 
     * @throws
     */
	public boolean checkUserPermission(String username, String appName, String resource, String permission);

}
